#pragma once
#ifndef _GAME_LAYER_
#define _GAME_LAYER_

#include "cocos2d.h"
#include <deque>

using namespace cocos2d;

class Pumples;

class GameLayer :public Layer {


public:
	static GameLayer* create();

	bool init();

	void onEnter() override;

	//还原
	void initTop();

	//初始化游戏场景
	void initBg();



	void updateSorllBg(float dt);
	void updateBird(float dt);
	void updatePumple(float dt);

	void update(float dt);

	void newGame();

	Layer* startLayer;
	Layer* loseLayer;

private:
	//小鸟
	Sprite* bird;
	std::deque<Pumples*> pumplesDeque;
	const int foregroundSpeed = 3.0f;
	const int backgroundSpeed = 1.5f;

	const float gravity = 0.32f;
	float velocity = 6;
	Director* dir;
	Size vsize;

	bool isRun = false;
	MenuItemImage* item1=nullptr;
	Label* scoreLabel=nullptr;
	int score=0;
};

#endif //_GAME_LAYER_